package de.shortys.myhome.api.view;

import static de.java.shortys.utils.view.ViewUtils.getIconFromString;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Observable;

import javax.swing.JPanel;

import net.miginfocom.swing.MigLayout;
import de.shortys.myhome.api.view.components.JImagePanel;

public class AbstractModuleViewFoot extends AbstractComponent {

	private JPanel leftPane;

	private JPanel centerPane;

	private JPanel rightPane;

	@Override
	public void update(Observable o, Object arg) {
		// Empty
	}

	@Override
	protected void buildComponents() {
		getContentPane().setOpaque(false);
		getContentPane().setLayout(new BorderLayout());
		buildLeftPane();
		buildCenterPane();
		buildRightPane();
	}

	private void buildRightPane() {
		rightPane = new JImagePanel(getIconFromString("de/shortys/myhome/api/view/images/moduleview_foot_right.png"));
		rightPane.setLayout(new BorderLayout());
		rightPane.setOpaque(false);
		rightPane.setPreferredSize(new Dimension(9, 26));
		getContentPane().add(BorderLayout.EAST, rightPane);
	}

	private void buildCenterPane() {
		centerPane = new JImagePanel(getIconFromString("de/shortys/myhome/api/view/images/moduleview_foot_center.png"));
		centerPane.setLayout(new MigLayout("", "0[grow]", "0[grow]"));
		centerPane.setOpaque(false);

		getContentPane().add(centerPane);
	}

	private void buildLeftPane() {
		leftPane = new JImagePanel(getIconFromString("de/shortys/myhome/api/view/images/moduleview_foot_left.png"));
		leftPane.setLayout(new BorderLayout());
		leftPane.setOpaque(false);
		leftPane.setPreferredSize(new Dimension(9, 26));
		getContentPane().add(BorderLayout.WEST, leftPane);
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}
}
